<%--
 *  File:    UserAreaOrContactMaps.jsp
 *  @Author: ChinaLiu
 *  Date:    2009-10-14

 *  Copyright (C) 2000 - 2009 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.OvalLabel" %>
<%@ page import="com.oval.util.OvalCustomMessage" %>
<%@ page import="com.oval.util.OvalCustomColumn" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  Category cat = Category.getInstance("jsp.UserAreaOrContactMaps");
  String privilegeCode = "H0253";
  String strTableName = "v_userplancontact";
  String strModuleName = "CRM";
  HashMap userinfo = new HashMap();
  userinfo = (HashMap)session.getAttribute("userinfo");
  Integer neworgid=new Integer(-1);
  if(userinfo.get("orgid")!=null)
  neworgid = (Integer)userinfo.get("orgid");
  
%>


<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/Print.inc"%>
<%@ include file="/inc/FrmDefault.inc"%>
<%@ include file="/inc/LocationDefault.inc"%>

<html>
<head>
<title>UserAreaOrContactMaps</title>
<PageFlow:CheckPageFlow pageName="p_userplancontactmaps"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../js/FuncLib.js"></script>
<script language="JavaScript" src="../js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
            <%
                        Vector totalsummary = (Vector) pageContext.getAttribute("totalsummary");
                        if (totalsummary == null)
                            totalsummary = new Vector();
                       Vector usercollection = (Vector) pageContext.getAttribute("usercollection");
                        if (usercollection == null)
                            usercollection = new Vector();
                        String strClassType = new String("");
                            
               %>
<script>


function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(areacontactmapsfrm,actionvalue,orderbyname);
  editform.action = "UserAreaOrContactMaps.jsp?<%= OvalTools.randomURL() %>&selectopt=all";  
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}


function page_delete()
{
     if(nullChecked(document.areacontactmapsfrm.areacontactmapsids,"<%=JspHelper.filterNull(totalsummary.size())%>"))
  {
    alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD") %>");
    return;
  }
  if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE")%>") ) 
    return;
  document.areacontactmapsfrm.actionname.value = "delete";
  document.areacontactmapsfrm.target = "_self";
  isRunning = true;
  document.areacontactmapsfrm.submit();
}

function page_add(){
	var newuserid = document.areacontactmapsfrm.newuserid.value;
 	if(newuserid=="" || newuserid==-1)
  	{
   	 alert("<%= message.getMessageDesc("MUST_SELECT_FIRST",label.getLabelName("L_User"))%>");
    return;
  	}
	
		var newentity = document.areacontactmapsfrm.newentity.value;
 	if(newentity=="" || newentity==-1)
  	{
   	 alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_AreaName"))%>");
    return;
  	}

 var frm = document.areacontactmapsfrm;
   frm.actionname.value = "add";
   frm.target = "_self";
   isRunning = true;
   frm.submit();

}


var popwindow;
   function page_selectArea()
{

  if(popwindow!=null)
    popwindow.close();
  popwindow = window.open('Businessarea.jsp?<%= OvalTools.randomURL() %>&languagecode=<%=JspHelper.filterNull( strFrmLanguageCode )%>','newwindow', 'height=450, width=350,top=150,left=300,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no');
}
function page_setArea(areaid,areaname)
{

  document.areacontactmapsfrm.newentity.value = areaid;
  document.areacontactmapsfrm.newareaname.value = areaname;
  if (popwindow != null)
    popwindow.close();
}

</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
 <form name="areacontactmapsfrm" method="post" action="../Dispatcher">
      <input type="hidden" name="pagename" value="p_userplancontactmaps">
      	<input type="hidden" name="actionname">
      	 <%@ include file="/inc/PageLocation.inc" %> 
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
    <td>
      <table width="100%" border="0" cellspacing="0">
        <tr>
          <td class="summary_top" colspan="2" ></td>
        </tr>
	<%@ include file="/inc/SummarySearch.inc" %>
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="100%">

        <tr class="deepblue-left">
          <td width="10%" class="title_center">&nbsp;</td>
          <td width="45%" class="title_center"><%= label.getLabelName("L_User") %></td>
          <td width="45%" class="title_center"><%= label.getLabelName("L_AreaName") %></td>
        </tr>
	<%int i=0; %>
	 <logic:iterate id="contactmapshash" collection="<%=totalsummary%>" indexId="orderid">
	 <%
	        
	 		            if(i%2 == 1)
            {
              strClassType = "td-listrom";
            }else{
              strClassType = "none";
            }
	  i++; 
	 %>
	 <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull(strClassType)%>'"  class="<%=JspHelper.filterNull( strClassType )%>" >
	 <td>
	 <input id="mp<%=JspHelper.filterNull(orderid)%>" type="checkbox" name="areacontactmapsids"  value="<custom:write property="userplancontactmapsid" name="contactmapshash" />" class="checkbox" > 
	 </td>
	 <td><custom:write property="username" name="contactmapshash" nbsp="true" /></td>
	 <td><custom:write property="areaname" name="contactmapshash" nbsp="true" /></td>
	 </tr>
	 </logic:iterate>
	 <tr>
	 <td>&nbsp;</td>
	 <td>
	 <custom:select  property="newuserid" optionsName="usercollection" optionValueKey="userid" optionInnerTextKey="username" style="width:100"/>
	 </td>
	 <td>
	<custom:text property="newareaname" size="15" readonly="true"></custom:text>
	 <a onclick="javascript:page_selectArea();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
	</td>
	 </tr>
	          <%@ include file="/inc/SummaryAction.inc" %>
    </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td class="summary_top" ></td>
        </tr>
        <tr>
          <td class="td_center">
          <input type="hidden" name="neworgid" value="<%=neworgid%>" />
          <input type="hidden" name="newtype" value="2" />
          <input type="hidden" name="newentity"/>
          <a onclick="page_add();"><custom:button type="1" label="L_Save" imgsrc="new.gif" border="0" style="width:60"/></a>
          <a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
 </form>
</body>
</html>